package com.kunteng.ynhxksh.controller;

import com.kunteng.ynhxksh.service.JYTJService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created By ShiYun with IntelliJ IDEA on 2018/4/2 10:28
 *
 * @author: ShiYun
 * @Email: 515867726@qq.com
 * @Date: 2018/4/2
 * To change this template use File | Settings | File Templates.
 */
@Api(tags = "交易统计接口")
@RestController
@RequestMapping("/jytj")
public class JYTJController {

    Logger logger = LoggerFactory.getLogger(JYTJController.class);

    @Autowired
    private JYTJService jytjService;

    @ApiOperation(value = "查询今日信息", notes = "返回包括今日交易额、今日交易笔数、今日开票笔数、今日开票今额的数据")
    @RequestMapping(value = "/findTodayInfo", method = RequestMethod.GET)
    public JSONObject findTodayInfo() {
        logger.info("findTodayInfo..");
        return jytjService.findTodayInfo();
    }


    @ApiOperation(value = "大额开票信息", notes = "返回最近10条大于1000元的开票信息，按时间倒叙输出")
    @RequestMapping(value = "/findLast10Info", method = RequestMethod.GET)
    public JSONArray findLast10KPInfo() {
        logger.info("findLast10KPInfo..");
        return jytjService.queryLastKPEmoreThan1000();
    }

    @ApiOperation(value = "各市县今日交易额信息", notes = "返回每个区交易额统计数据，不包括父级统计")
    @RequestMapping(value = "/findTodayJYEInfoByQX", method = RequestMethod.GET)
    public JSONArray findTodayJYEInfoByQX() {
        logger.info("findTodayJYEInfoByQX..");
        return jytjService.findTodayJYEInfoByQX();
    }

    @ApiOperation(value = "今日交易额走势信息", notes = "返回每半小时交易额统计数据")
    @RequestMapping(value = "/findTodayJYEZS", method = RequestMethod.GET)
    public List<Map> findTodayJYEZS() {
        logger.info("findTodayJYEZS..");
        return jytjService.queryTodayJYZS();
    }

    @ApiOperation(value = "今日开票额走势信息", notes = "返回每小时开票额统计数据")
    @RequestMapping(value = "/findTodayKPEZS", method = RequestMethod.GET)
    public List<Map> findTodayKPEZS() {
        logger.info("findTodayKPEZS..");
        return jytjService.queryTodayKPZS();
    }

    @ApiOperation(value = "一周交易额走势信息", notes = "返回六天前到今天的日交易额统计数据")
    @RequestMapping(value = "/findWeekJYEZS", method = RequestMethod.GET)
    public JSONArray findAWeeKJYEZS() {
        logger.info("findAWeeKJYEZS..");
        return jytjService.queryAWeekJYZS();
    }

    @ApiOperation(value = "一周交开票额走势信息", notes = "返回六天前到今天的日开票额统计数据")
    @RequestMapping(value = "/findWeekKPEZS", method = RequestMethod.GET)
    public JSONArray findAWeekKPEZS() {
        logger.info("findAWeekKPEZS..");
        return jytjService.queryAWeekKPZS();
    }

    @ApiOperation(value = "今日企业交易额TOP5", notes = "返回今天交易额前5的企业信息")
    @RequestMapping(value = "/findTodayJYETop5", method = RequestMethod.GET)
    public List<Map> findTodayJYETop5() {
        logger.info("findTodayJYETop5..");
        return jytjService.queryTodayJYETop5();
    }

    @ApiOperation(value = "今日企业开票额TOP5", notes = "返回今天开票额前5的企业信息")
    @RequestMapping(value = "/findTodayKPETop5", method = RequestMethod.GET)
    public List<Map> findTodayKPETop5() {
        logger.info("findTodayKPETop5..");
        return jytjService.queryTodayKPETop5();
    }

    @ApiOperation(value = "地区交易额占比", notes = "返回按地区统计交易额")
    @RequestMapping(value = "/findDQJYE", method = RequestMethod.GET)
    public JSONArray findDQJYE() {
        logger.info("findDQJYE..");
        return jytjService.findDQJYE();
    }

    @ApiOperation(value = "行业交易额占比", notes = "返回按行业统计交易额")
    @RequestMapping(value = "/findHYJYE", method = RequestMethod.GET)
    public JSONArray findHYJYE() {
        logger.info("findHYJYE..");
        return jytjService.findHYJYE();
    }

}
